package config

import (
	"generatorserver/feature"
)

type RuntimeEnv uint8

const (
	EnvDev RuntimeEnv = iota + 1
	EnvTest
	EnvRelease
)

func (p RuntimeEnv) String() string {
	switch p {
	case EnvDev:
		return "develop"
	case EnvTest:
		return "test"
	case EnvRelease:
		return "release"
	default:
		return "UnkownEnv"
	}
}

// 获取程序的运行环境
func GetRuntimeEnv() RuntimeEnv {
	ft := feature.Instance()
	if ft.Env.Test {
		return EnvTest
	}
	if ft.Env.Develop {
		return EnvDev
	}
	return EnvRelease
}
